/*
 * @Description: 
 * @Autor: 万洲
 * @Date: 2022-10-17 09:50:06
 * @LastEditors: 万洲
 * @LastEditTime: 2022-11-16 13:33:49
 */
const { defineConfig } = require('@vue/cli-service')
const timestamp = new Date().getTime()
const packageName = require('./package.json').name;
const UnoCSS = require('@unocss/webpack').default
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
module.exports = defineConfig({
  // transpileDependencies: true,
  // 去掉sourcemap
  productionSourceMap: false,
  configureWebpack: {
    output: {
      filename: `js/[name]-${timestamp}.js`,
      chunkFilename: `js/[name]-${timestamp}.js`,
    },
    plugins: [
      UnoCSS()
    ],
  },
  css: {
    loaderOptions: {
      css: {
        modules: {
          auto: true,//自动匹配符合modules规则的样式文件
          localIdentName: "className-[local]-[hash:base64:5]",
          // localIdentName: "[path][name]__[local]--[hash:base64:5]",
        },
      }
    },
  },
  devServer: {
    allowedHosts: 'all',
    historyApiFallback: true,
    headers: {
      'Access-Control-Allow-Origin': '*',
    },
  },
  chainWebpack: config => {
    config.module
      .rule('worker-loader')
      .test(/\.worker\.js$/)
      .use({
        loader: 'worker-loader',
        options: {
          inline: true
        }
      })
      .loader('worker-loader')
      .end()

  },

})

